home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2428 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.5 KB  |  80 lines

  1. Path: futures.wharton.upenn.edu!ryan05
  2. From: ryan05@futures.wharton.upenn.edu (Arthur Ryan)
  3. Newsgroups: comp.lang.c++
  4. Subject: Array Assistance Redux
  5. Date: 17 Jan 1996 19:06:46 GMT
  6. Organization: University of Pennsylvania
  7. Message-ID: <4djhc6$pur@netnews.upenn.edu>
  8. NNTP-Posting-Host: futures.wharton.upenn.edu
  9. X-Newsreader: TIN [version 1.2 PL2-upenn1.1]
  10.  
  11. I am trying to load a "CSV" file from my disk in to a two dimensional 
  12. array for manipulation.  Right now I'd settle for just verifying the 
  13. array as being filled.  The programme compiles fine.  But when I run the 
  14. programme the computer just displays 'running' in the status box and I 
  15. have to 'CTRL+Alt+Del' followed by 'Enter' to terminate the freeze up.  
  16. The drive does activate but apart from that I have no indication the 
  17. programme is executing correctly.  Help greatly appreciated.  Thanks in 
  18. Advance. 
  19.  
  20. Code Below:-
  21.  
  22.  
  23. #include <iostream.h>
  24. #include <stdio.h>
  25. #include <stdlib.h>
  26. #include <fstream.h>
  27. #include <io.h>
  28.  
  29.  
  30. disp_menu();
  31. data_in();
  32.  
  33. int oda[2][29];  
  34.  
  35. main()
  36. {
  37.  
  38. menu and other unproblematic code etc ...
  39. }
  40.  
  41. data_in()
  42. {
  43. int i,j;
  44.  
  45. ifstream fsin;
  46. fsin.open("A:\n&n\test.csv",ios::in);
  47.  
  48. if(fsin.bad())
  49.     {
  50.     cout << "\n*** Serious I/O error ***\n";
  51.     exit(0);
  52.     }
  53.  
  54. while (!fsin.eof())
  55.     {
  56.         for (i=0;i<2;i++)
  57.                {
  58.                    for(j=0;j<29;j++)
  59.                 {
  60.                    fsin >> oda [i][j];
  61.                    }
  62.                ;
  63.                }
  64.     }
  65.  
  66. fsin.close();
  67.  
  68. for (i=0;i<2;i++)
  69. {
  70.     for (j=0;j<29;j++)
  71.     {
  72.      cout << oda [i][j];
  73.     }
  74. cout << endl;
  75. }    
  76.  
  77. return(0);
  78. }
  79.  
  80.